/* 
 * File:   main.cpp
 * Author: Marco Ambu
 *
 * Created on September 30, 2010, 6:16 PM
 */

#include "Opengl.h"
#include "OpenglWindow.h"
#include "TeapotShape.h"

int main(int argc, char** argv)
{
  Opengl gl(&argc, argv);

  bool doubleBuffer = false;
  for (int i = 1; i < argc; ++i)
  {
    if (std::string(argv[i]) == "-sb")
    {
      doubleBuffer = false;
    }
    else if (std::string(argv[i]) == "-db")
    {
      doubleBuffer = true;
    }
  }
  
  OpenglWindow window;
  window.setTitle("Teapot C++").setWidth(400).setHeight(300).setDoublebuffer(doubleBuffer);
  window.create();

  gl.registerDisplayHandler(&window);
  gl.registerReshapeHandler(&window);
  gl.registerKeyboardHandler(&window);

  window.addShape(TeapotShape());
  window.addShape(TeapotShape(1, 1));
  window.addShape(TeapotShape(2, 2, 2));
  TeapotShape t(-2, -2);
  t.setSize(2);
  t.setWireframe();
  window.addShape(t);

  gl.run(); // will never return :-(

  return 0;
}
